// 组织架构相关接口
import request from '@/utils/request'

/**
 * @description 获取组织框架列表
 * @returns Promise
 */
export const getDepartmentList = () => {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

/**
 * @description 获取员工简单列表
 * @returns Promise
 */
export const getStaffList = () => {
  return request({
    url: 'sys/user/simple'
  })
}

/**
 * @description 新增部门
 * @param {*} data code introduce manager name pid
 * @returns Promise
 */
export const addDepartment = (data) => {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * @description 根据ID删除部门
 * @param {*} id
 * @returns Promise
 */
export const removeDepartment = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

// 根据ID查询部门详情
/**
 * @description 根据ID查询部门详情
 * @param {*} id
 * @returns Promise
 */
export const getDetailsById = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'GET'
  })
}

// 根据ID修改部门详情
export const setDetailById = (id, data) => {
  return request({
    url: `/company/department/${id}`,
    method: 'PUT',
    data
  })
}
